home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / MOD1-4.C < prev    next >
C/C++ Source or Header  |  1993-06-10  |  5KB  |  148 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 06-06-93 (11:27)             Number: 220
  4. From: DANIEL LYNES                 Refer#: NONE
  5.   To: MATTHEW O'CONNOR              Recvd: NO  
  6. Subj: Mod File Routines 4/4          Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8.   /*******************/
  9.   /* decode MOD file */
  10.   /*******************/
  11.  
  12.   /* first bits of header */
  13.  
  14.   _read(handle,(*mod2).Name,20);
  15.    mod2->Name[20] = '\0';       /* Make sure name is terminated */
  16.   printf("%s\n",mod2->Name);
  17.  
  18.   /* ---------------- */
  19.   /* Load instraments */
  20.   /* ---------------- */
  21.  
  22.   for ( c = 0 ; c < 31 ; c ++)
  23.   {
  24.     Read_Inst(&mod2->Inst[c],handle);
  25.     /*Print_Inst(&mod2->Inst[c]);
  26.     printf("------------------------\n"); */
  27.   };
  28.  
  29.   /* -------------- */
  30.   /* Load song info */
  31.   /* -------------- */
  32.  
  33.   _read(handle,ta,2);  /* buffer it in   */
  34.  
  35.   mod2->Len = ta[0];     /* length of song */
  36.  
  37.   _read(handle,&mod2->Pat,MAXPAT);
  38.  
  39.   _read(handle,&mod2->Mark,4);
  40.  
  41.   printf("%.4s \n",mod2->Mark);  /* should be M.K. or FLT4 or FLT8 */
  42.  
  43.  
  44.   for (c=0; c<MAXTRACK;c++)
  45.     {
  46.      Read_Track(mod2->Track[c],handle);
  47.      Print_Track(mod2->Track[c]);
  48.     };
  49.  
  50.   Read_Samp(&mod2->Inst[1],ptr);
  51.   printf("Load Samp\n");
  52.  
  53.   ptr = (char *) fptr;
  54.  
  55.   _close(handle);
  56.   return(0);
  57. }
  58.  
  59.  
  60. int main (void) {
  61.   struct S_Mod mod;
  62.   int t;
  63.  
  64.   for (t=0;t<MAXTRACK;t++)
  65.     {
  66.      mod.Track[t] = (struct S_Track*)malloc(sizeof(struct S_Track));
  67.      if (mod.Track[t] == NULL)
  68.        {
  69.  printf("Ran out of Ram!\n");
  70.  exit(1);
  71.        };
  72.     };
  73.  
  74.   char songname[40]="b.mod\0";
  75.  
  76.   printf("-------\n");
  77.   Load_Song(songname,&mod);
  78.   return(0);
  79. }
  80. /**************************************************************/
  81. /*                      Mod2.H                                */
  82. /**************************************************************/
  83. /*      This is the header file for Mod_File.c  All copy      */
  84. /*  right information is in that document.  This file is an   */
  85. /* extenstion of that program.           */
  86. /**************************************************************/
  87. /*          Written by Kirk Smith (1:105/290.7)               */
  88. /**************************************************************/
  89.  
  90.  
  91. struct S_Note {                     /* Structure of Mod Note  */
  92.    public:
  93.    byte Num;                        /* Instrament Number      */
  94.    word Period;                     /* Note period            */
  95.    word Effect;                     /* Effect command         */
  96. };
  97.  
  98. struct S_Channel {                  /* Structure of Mod Chan  */
  99.    public:
  100.    struct S_Note Chan[MAXCHAN];     /* 0,2 Left 1,3 Right     */
  101. };
  102.  
  103. struct S_Track {                    /* Structure of Mod Track */
  104.    public:
  105.    struct S_Channel Note[MAXNOTES]; /* 64 notes per track     */
  106. };
  107.  
  108. struct S_Song {              /* Structure of Mod Song  */
  109.    public:
  110.    struct S_Track *Track[MAXTRACK];  /* MAX tracks per song    */ };
  111.  
  112. struct S_Inst {              /* Structure of Mod Inst  */
  113.    public:
  114.    char    Name[23];             /* Instrament Name       */
  115.    word    Len;              /* Inst Sample Name       */
  116.    byte    F_Tune;             /* Fine Tunning Sample    */
  117.    byte    Vol;              /* Inst Volume Level      */
  118.    word    R_Start;             /* Repeat Start       */
  119.    word    R_Len;                   /* Repeat Lenght       */
  120.    char   *Samp;                    /* Pointer to Sample      */
  121. };
  122.  
  123.  
  124. struct S_Mod {       /* Structure of whole Mod */
  125.    public:
  126.    char    Name[21];             /* Song Name       */
  127.    struct S_Inst  Inst[MAXINST];    /* Instraments of song    */
  128.    byte    Len;              /* Lenght of song file    */
  129.    byte    Ciaa;             /* CIAA Speed (not used)  */
  130.    char    Mark[4];             /* Mod Mark M.K./FLT4/FLT8*/
  131.    byte    Pat[MAXPAT];             /* Pattern to play tracks */
  132.    struct S_Track *Track[MAXTRACK]; /* Tracks of the song.
  133.          NOTE: S_Song wasn't used */
  134. };
  135.  
  136. N.B.  There was a young gentleman on NANet that had originally
  137. posted this.  This young man was the above signed.  If you would
  138. like to find out more about it, I would suggest contacting Kirk
  139. Smith on North AmeriNet (from Canada Remote Systems).
  140.  
  141.  * SLMR 2.1a * Beware of the powermonging InterLink Moderators.
  142.  
  143. --- SLMAIL v3.0  (#0272)
  144.  * Origin: Thunder Bay, Ontario, Canada (1:229/516)
  145. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  146. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 430 575 950 203/23 209/209
  147. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  148.